package com.practice.Socket;

import java.net.Socket;

public class Client {
    public void connect() {
        try {
            ClientProcessor processor = new ClientProcessor();
            Socket socket = new Socket("127.0.0.1", 8081);
            new Thread(processor.new SocketSender(socket.getOutputStream(), 0, 0, "客户端")).start();
            new Thread(processor.new SocketReceiver(socket.getInputStream(), 0, 0, "客户端")).start();
        } catch (Exception e) {
            System.out.println("Error" + e); //出错，则打印出错信息
        }

    }

    public static void main(String[] args) {
        Client c = new Client();
        c.connect();
    }
}
